package com.starblink.wishlist.wishallitems.ui.cell

import android.graphics.drawable.AnimationDrawable
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.starblink.android.basic.adapter.BaseBindingVH
import com.starblink.android.basic.ext.click
import com.starblink.android.basic.ext.dp
import com.starblink.android.basic.ext.margin
import com.starblink.android.basic.sensorsdata.extension.trackData
import com.starblink.android.basic.sensorsdata.spm.cfg.SpmElementDef
import com.starblink.android.basic.sensorsdata.spm.cfg.SpmPageDef
import com.starblink.android.basic.util.bus.FlowBus
import com.starblink.android.basic.util.bus.FlowConst
import com.starblink.basic.style.databinding.EmptyViewWishFilterBinding
import com.starblink.basic.style.databinding.EmptyViewWishNormalBinding
import com.starblink.basic.style.view.mutian.AnimationResourceModel
import com.starblink.basic.style.view.mutian.AnimationsContainer2
import com.starblink.wishlist.wishallitems.ui.bean.RvFilterEmpty
import com.starblink.wishlist.wishallitems.ui.bean.RvNormalEmpty


/**
 * feeds无数据
 */
class EmptyNormalCell(
    binding: EmptyViewWishNormalBinding
) :
    BaseBindingVH<RvNormalEmpty, EmptyViewWishNormalBinding>(binding) {


    init {
        itemView.layoutParams = StaggeredGridLayoutManager.LayoutParams(
            StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT,
            StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT
        ).apply {
            isFullSpan = true
        }
    }


    override fun onBind(model: RvNormalEmpty, position: Int) {
        binding.marginLayoutTop.margin(topMargin = 72.dp)
        binding.emptyButton.click {
            //显示底部导航
//            FlowBus.boolFlowBusNotify(FlowConst.HIDE_MAIN_BOTTOM_TAB)
            FlowBus.boolFlowBusNotify(FlowConst.SWITCH_TO_HOME_PAGE)
            FlowBus.boolFlowBusNotify(FlowConst.SWITCH_TO_HOME_PAGE_WISHLIST)
        }

        binding.emptyButton.trackData(
            page = SpmPageDef.WishListEditPage_10028,
            element =SpmElementDef.Element_33063,
            onlyHit = true
        )
    }

}


class EmptyFilterCell(
    var displayType: Int = 0,
    binding: EmptyViewWishFilterBinding
) :
    BaseBindingVH<RvFilterEmpty, EmptyViewWishFilterBinding>(binding) {


    init {
        itemView.layoutParams = StaggeredGridLayoutManager.LayoutParams(
            StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT,
            StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT
        ).apply {
            isFullSpan = true
        }
    }

    override fun onBind(model: RvFilterEmpty, position: Int) {
        if (displayType == 1) {
            binding.marginLayoutTop.margin(topMargin = 152.dp)
            binding.msgSub.text = "No products found in this region"
        } else {
            binding.msgSub.text = "No related products have been \nadded to the wishlist"
        }


    }
}










